package cn.school.controller;


import cn.school.dto.FindObjectScoreDto;
import cn.school.dto.ObjectScoreDto;
import cn.school.service.ScoreSubjectService;
import cn.school.vo.ResultVo;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

@RestController
@RequestMapping("/score")
public class ScoreController {
    @Resource
    private ScoreSubjectService scoreSubjectService;
    @RequestMapping("/setSubjectScore")
    public String setSubjectScore(@RequestBody ObjectScoreDto objectScoreDto, HttpServletRequest request) {
        // 调用业务层方法设置分数
        String message = scoreSubjectService.setSubjectScore(objectScoreDto, request);
        return message;
    }
    @RequestMapping("/findObjectScore")
    public ResultVo findObjectScore(@RequestBody FindObjectScoreDto findobjectScoreDto, HttpServletRequest request) {
        ResultVo resultVo = scoreSubjectService.findObjectScore(findobjectScoreDto, request);
        return resultVo;
    }
    @RequestMapping("/findTotalScore")
    public ResultVo findTotalScore(Integer sessionId, HttpServletRequest request) {
        ResultVo resultVo = scoreSubjectService.findTotalScore(sessionId, request);
        return resultVo;
    }
}
